package com.zd.user.controller;

import com.zd.common.bean.ZdNovelResponse;
import com.zd.common.enums.ResponseStatus;
import org.springframework.web.bind.annotation.*;

/**
 * 用户微服务Controller
 */
@RestController
@RequestMapping("/user")
public class UserController {
    /**
     *  登陆
     */
    @PostMapping("/login")
    public ZdNovelResponse login(){

        return ZdNovelResponse.ok();
    }

    /**
     * 注册
     *
     */
    @PostMapping("/register")
    public ZdNovelResponse register(){
        String token = "jwtToken";
        return ZdNovelResponse.ok(token);

    }

    /**
     * 查询个人信息
     * */
    @GetMapping("/userInfo")
    public ZdNovelResponse userInfo(){
        return ZdNovelResponse.ok();
    }

    /**
     * 更新个人信息
     * */
    @PostMapping("/updateUserInfo")
    public ZdNovelResponse updateUserInfo(){
        return ZdNovelResponse.ok();
    }

    /**
     * 刷新用户token
     */
    @PostMapping("/refreshToken")
    public ZdNovelResponse refreshToken(){
        String token = "";
        if (token != null && token.length() != 0) {//token不为空，刷新token
            token = "refresh";
            return ZdNovelResponse.ok();

        }else {//token为空，表示用户未登录
            return ZdNovelResponse.fail(ResponseStatus.NO_LOGIN);
        }

    }

    /**
     * 加入书架
     * */
    @PostMapping("/addToBookShelf")
    public ZdNovelResponse addToBookShelf(){
        return ZdNovelResponse.ok();
    }

    /**
     * 移出书架
     * */
    @DeleteMapping("/removeFromBookShelf")
    public ZdNovelResponse removeFromBookShelf(){
        return ZdNovelResponse.ok();
    }

    /**
     * 分页查询书架
     * */
    @GetMapping("/listBookShelfByPage")
    public ZdNovelResponse<?> listBookShelfByPage(){
        return ZdNovelResponse.ok();
    }

    /**
     * 分页查询阅读记录
     * */
    @GetMapping("/listReadHistoryByPage")
    public ZdNovelResponse listReadHistoryByPage(){
        return ZdNovelResponse.ok();
    }

    /**
     * 添加阅读记录
     * */
    @PostMapping("/addReadHistory")
    public ZdNovelResponse addReadHistory(){
        return ZdNovelResponse.ok();
    }
}
